package com.niiwoo.civet.trade.service.local.newRefund.notify.mq;

import java.util.Date;

import org.springframework.stereotype.Component;

import com.niiwoo.activity.event.dto.request.ProjectStatusChangeEventReqDTO;
import com.niiwoo.activity.event.enums.ProjectStatusEventEnum;
import com.niiwoo.activity.event.enums.ProjectSubStatusEventEnum;
import com.niiwoo.civet.trade.dao.entity.Project;
import com.niiwoo.civet.trade.service.local.newRefund.notify.dto.RefundNotifyDTO;
import com.niiwoo.civet.trade.service.local.newRefund.notify.enums.RefundNotifyEnum;

/**
 * 活动中心标的状态变更MQ通知
 * 
 * 触发条件：标的逾期、标的结清、标的逾期到正常还款
 *
 * @author: kevin.jia
 * @version 1.0.0
 */
@Component
public class ActivityEventProjectStatusNotify extends MQRefundNotify {
	
	@Override
	public Object bulidParam(RefundNotifyDTO refundNotifyDTO) {
		Project project = refundNotifyDTO.getProject();
		
		ProjectStatusChangeEventReqDTO projectStatusChangeEventReqDTO = new ProjectStatusChangeEventReqDTO();
		projectStatusChangeEventReqDTO.setProjectId(project.getPrizeId());
		projectStatusChangeEventReqDTO.setUserId(project.getBorrowUserId());
		projectStatusChangeEventReqDTO.setProjectStatusEventEnum(ProjectStatusEventEnum.enumOf(project.getStatus()));
		projectStatusChangeEventReqDTO.setProjectSubStatusEventEnum(ProjectSubStatusEventEnum.enumOf(project.getSubStatus()));
		projectStatusChangeEventReqDTO.setUpdateDate(new Date());
		
		return projectStatusChangeEventReqDTO;
	}
	
	@Override
	public RefundNotifyEnum getType() {
		return RefundNotifyEnum.ACTIVITY_EVENT_PROJECT_STATUS_CHANGE;
	}
}